package cn.edu.zufe.mjt.insight;

public class LogAndDiscardRejectHandle implements RejectHandle {
    @Override
    public void reject(Runnable rejectCommand, MyThreadPool threadPool) {
        String taskInfo = String.format("任务被丢弃：%s，线程池状态 - 核心线程数: %d, 当前线程数: %d, 队列大小: %d",
                rejectCommand,
                threadPool.getCorePoolSize(),
                threadPool.getActiveCount(),
                threadPool.blockingQueue.size());

        System.err.println(taskInfo);
        // 可扩展：发送监控消息、写入日志文件、调用报警接口等
    }
}